import { faker } from "@faker-js/faker";
// @ts-expect-error defineFakeRoute
import { defineFakeRoute } from "vite-plugin-fake-server/client";
import dayjs from "dayjs";

export default defineFakeRoute([
  {
    url: "/leftPageData",
    method: "post",
    response: () => {
      return {
        code: 200,
        message: "success",
        data: {
          trafficStatus: {
            accessFrequency: faker.number.int({ min: 1, max: 1000 }),
            peakFlow: faker.number.int({ min: 1, max: 1000 }),
            traffic: {
              timeList: ["9:00", "12:00", "15:00", "18:00", "21:00", "00:00"],
              outData: [
                faker.number.float({ min: 1, max: 1000 }).toFixed(2),
                faker.number.float({ min: 1, max: 1000 }).toFixed(2),
                faker.number.float({ min: 1, max: 1000 }).toFixed(2),
                faker.number.float({ min: 1, max: 1000 }).toFixed(2),
                faker.number.float({ min: 1, max: 1000 }).toFixed(2),
                faker.number.float({ min: 1, max: 1000 }).toFixed(2)
              ],
              inData: [
                faker.number.float({ min: 1, max: 1000 }).toFixed(2),
                faker.number.float({ min: 1, max: 1000 }).toFixed(2),
                faker.number.float({ min: 1, max: 1000 }).toFixed(2),
                faker.number.float({ min: 1, max: 1000 }).toFixed(2),
                faker.number.float({ min: 1, max: 1000 }).toFixed(2),
                faker.number.float({ min: 1, max: 1000 }).toFixed(2)
              ]
            }
          },
          userStatus: {
            header: ["用户", "时间", "状态"],
            data: [
              [faker.person.firstName(), dayjs(faker.date.anytime()).format("YYYY-DD-MM HH:mm:ss"), "在线"],
              [faker.person.firstName(), dayjs(faker.date.anytime()).format("YYYY-DD-MM HH:mm:ss"), "离线"],
              [faker.person.firstName(), dayjs(faker.date.anytime()).format("YYYY-DD-MM HH:mm:ss"), "在线"],
              [faker.person.firstName(), dayjs(faker.date.anytime()).format("YYYY-DD-MM HH:mm:ss"), "在线"],
              [faker.person.firstName(), dayjs(faker.date.anytime()).format("YYYY-DD-MM HH:mm:ss"), "在线"],
              [faker.person.firstName(), dayjs(faker.date.anytime()).format("YYYY-DD-MM HH:mm:ss"), "离线"],
              [faker.person.firstName(), dayjs(faker.date.anytime()).format("YYYY-DD-MM HH:mm:ss"), "在线"],
              [faker.person.firstName(), dayjs(faker.date.anytime()).format("YYYY-DD-MM HH:mm:ss"), "在线"],
              [faker.person.firstName(), dayjs(faker.date.anytime()).format("YYYY-DD-MM HH:mm:ss"), "离线"],
              [faker.person.firstName(), dayjs(faker.date.anytime()).format("YYYY-DD-MM HH:mm:ss"), "离线"],
              [faker.person.firstName(), dayjs(faker.date.anytime()).format("YYYY-DD-MM HH:mm:ss"), "离线"],
              [faker.person.firstName(), dayjs(faker.date.anytime()).format("YYYY-DD-MM HH:mm:ss"), "离线"]
            ]
          }
        }
      };
    }
  }
]);
